The present invention relates to the field of computer graphics, and in particular to methods and apparatus for optimizing the determination of attributes associated with surface points.
Many computer graphic images are created by mathematically modeling the interaction of light with a three dimensional scene from a given viewpoint. This process, called rendering, generates a two-dimensional image of the scene from the given viewpoint, and is analogous to taking a photograph of a real-world scene. Animated sequences can be created by rendering a sequence of images of a scene as the scene is gradually changed over time. A great deal of effort has been devoted to making realistic looking rendered images and animations.
Surface attribute functions can define the values of attributes of surfaces in three-dimensional space. Surface attribute functions can be evaluated at any point on the surface to provide corresponding attribute values at that point on the surface. Attributes of surfaces can include optical properties of a surface, such as color, transparency, reflectivity, and refractivity. Attributes can also include visibility or occlusion information; artistically or procedurally generated texture data in one, two, three, or more dimensions; noise functions in one, two, three, or more dimensions, which can be used to procedurally generate or modify other surface attributes; shadow generation information; forces or attributes used for physics, cloth, fluid, or other types of simulations; animation data, which can be used to specify motion of entities associated with a surface point, such as fur or hair; modeling parameters, such as the density of procedurally generated grass applied to a model of a landscape; illumination information, which specifies the amount and direction of light on the surface point from other portions of the scene; and rendering information, such as ray tracing path information or radiosity rendering information. Functions can be relatively simple, such as looking up texture data from a texture map, or very complex, such as the evaluation of complex user-defined shader programs, ray tracing programs, animation or modeling programs, or simulation programs.
An application such as a rendering or animation application determines pixel values in an image by evaluating or sampling a surface and its associated surface attribute functions. Surfaces can include triangles and polygons; higher-order surfaces such as B-splines; subdivision surfaces; and implicit surfaces, among others.
In one rendering technique, surfaces are divided or “tessellated” into a mesh of sub-pixel size quadrilaterals, typically referred to as “micropolygons.” A shader evaluates surface attribute functions to assign a color or other attribute values to a vertex of each micropolygon. Shading can be computed for each corner vertex, and then be interpolated, or can be computed only once for the whole micropolygon. The shading rate specifies the size and number of micropolygons, and hence the number of samples of the surface attribute function evaluated for surfaces. In many instances a pixel might contain at least portions of several micropolygons. By averaging, weighting, filtering, or otherwise combining these micropolygons, the renderer can determine values for each pixel and create a highly detailed image. In some applications, each pixel is associated with a filter kernel specifying the weights used to combine samples as a function of distance from the center of the pixel.
Selecting the optimal sampling or shading rate is critical for creating high quality images. If the sampling rate is too low, the surface attribute functions of a surface will be undersampled, resulting in a blurred image and other loss of detail. However, if the sampling rate is increased, the number of surface attribute function samples required to render the image increases, which dramatically increases the time, memory, and computing resources needed to render an image.
Ideally, the size of the samples of a surface attribute function should be equal to the size of a pixel's filter kernel projected onto the surface. For example, a circular pixel filter kernel projected onto a surface aligned with the image plane defines a circular region on the surface. This example circular region is the ideal sample size for surface attribute functions at this point on the surface.
However, most surfaces are angled, rather than aligned, with the image plane. As a result, if the kernel of a pixel in the image plane is projected onto the angled surface, the shape of the corresponding region of the surface to be sampled will be distorted from that of original filter kernel. For example, if a circular pixel filter kernel projected onto a surface angled relative to the image plane, the corresponding sample region will be shaped like an ellipse. Similarly, a square pixel filter kernel projected onto a surface angled relative to the image plane results in a trapezoid shaped for the corresponding sample region. Generally, this requires surfaces at an angle to the image plane to be sampled anisotropically, or at different sample rates in different directions, to accurately evaluate surface attribute functions.
Many renderers ignore the need for anisotropic sampling and use isotropic samples, or samples that are the same size in all directions, for all surfaces, regardless of the actual shape of the sample region. When the area of the sample exceeds the area of the desired sample region, such as when a circular sample is used to approximate an elliptical sample region, the sample may include significant amounts of data outside the desired sample region. This excess data included in the sample causes unwelcome blurring artifacts of the surface attribute functions. These blurring artifacts are especially noticeable if the surface attribute function includes sharp details, such as a texture map with text or sharp lines, or if the angle between the image plane and the surface is large.
To compensate for these artifacts, the sampling rate can be increased to produce smaller samples. The increased number of smaller samples better approximates the elliptical shape of the desired sample area. However, increasing the sampling rate for an entire image results in an enormous increase in the amount of data to be processed. In some cases, decreasing the sample size to a point where desired accuracy or sharpness is obtained for the entire image is not practical, as the memory requirements or necessary rendering time are too great. This is especially undesirable when only a small portion of the image, such as fine lines or writing, is unacceptably blurred or otherwise needs improved sampling.
To more accurately sample surfaces angled to the image plane, it would be desirable to use samples or filter kernels, for example, that have different sized edges, or that otherwise have different dimensions in various directions. For example, an elliptical filtering approach uses an elliptical-shaped distribution of samples to evaluate various surface attribute functions. The elliptical samples match the elliptically-shaped sample regions produced by the projection of an elliptical filter kernel on to a surface at an angle to the image plane. Elliptical filtering, however, is analytically and computationally difficult to implement. Doing accurate elliptical filtering would require determining the size and direction or orientation of each elliptical filtering region used for the various surfaces of an image.
It therefore is desirable to develop a process for increasing the detail of an image, or a portion of an image, by approximating sampling areas such as elliptical sampling areas that more accurately represent those surface portions that, when projected onto the image plane, correspond to pixels of the final image.